<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
<input type="text" placeholder="请输入0-100的数字" v-model="z">
<input type="button" value="猜一猜" @click="f()" >
<h1 >结果:{{result}}</h1></div>
<script src="../js/vue.js"></script>
<script>
     let r = parseInt(Math.random()*101);
      let v = new Vue({
        el:"div",
        data:{
           result:"",
           z:"",
        },
        methods:{
        f(){
            if(v.z==r){
              v.result = "猜对了";
            }else if(v.z>r){
              v.result = "猜大了";
            }else {
              v.result = "猜小了";
            }
        }

        }

      })
</script>
</body>
</html>